<template>
    <div class="user-view">
        <mt-header fixed title="我的" class="mt-header"></mt-header>
        
        <div v-if="isLogin">
            <my-cell to="/myinfo" title="个人资料" icon="iconfont icon-yonghu" :value="myinfo.name" iconstyle="color: #FF9B01;"></my-cell>
            <my-cell to="/mymailbox" title="个人信箱" icon="iconfont icon-dengji" iconstyle="color: #3EE88F;"></my-cell>
            <my-cell to="/sysnotice" title="系统公告" icon="iconfont icon-tongzhi" iconstyle="color: #FF0089;"></my-cell>
            <my-cell to="/enter" title="信号源入驻" icon="iconfont icon-tongzhi" iconstyle="color: #FF0089;"></my-cell>
            <my-cell to="/follow-account" title="跟随者账户" icon="iconfont icon-tongzhi" iconstyle="color: #FF0089;"></my-cell>
        </div>
        <div v-else>
            <my-cell to="/login" title="登录" icon="iconfont icon-denglu" iconstyle="color:#7AE804;" ></my-cell>
            <my-cell to="/register" title="注册" icon="iconfont icon-loginout" iconstyle="color: #E83E0C;"></my-cell>
        </div>

        <div class="spacing"></div>

        <my-cell to="/supplier" title="优质供应商" icon="iconfont icon-tongzhi"></my-cell>
        <my-cell to="/bigdata" title="大数据分析" icon="iconfont icon-tongzhi"></my-cell>
        <!-- <my-cell title="社汇圈动态" icon="iconfont icon-tongzhi"></my-cell> -->
        <my-cell to="/help" title="帮助中心" icon="iconfont icon-bangzhu"></my-cell>
        <my-cell title="联系客服" icon="iconfont icon-tongzhi" value="400-033-1218"></my-cell>

        <div class="spacing"></div>

        <my-cell to="/set" title="设置" icon="iconfont icon-shezhi-"></my-cell>
        <my-cell to="/about" title="关于" icon="iconfont icon-fengkong"></my-cell>
        
        <div class="spacing"></div>

        <div v-if="isLogin">
            <my-cell title="退出登录" icon="iconfont icon-loginout" @click.native="loginOut" iconstyle="color: #E83E0C;"></my-cell>
        </div>

        <my-footer></my-footer>
    </div>
</template>

<script>
    import { mapState } from 'vuex'
    import { getCookie } from '@/assets/js/cookie.js'
    export default {
        name: 'UserView',
        computed: {
            ...mapState({
                isLogin: state => state.user.isLogin,
                myinfo: state => state.user.myinfo
            })
        },
        methods: {
            loginOut() {
                this.$store.dispatch('loginOut')
            }
        },
        created() {
            // this.$store.dispatch('sync')
        }
    }
</script>

<style scoped>
    .user-view{
        margin-bottom: 50px;
        padding: 40px 15px 0 15px;
        text-align: left;
    }
    .mt-header {
        background: #fff;
        color: #666;
        border-bottom: 1px solid #FFF54C;
    }
    .spacing {
        /*margin-top: 5px;*/
        height: 10px;
        background: #eee;
        margin: -1px -15px 0 -15px;
    }
</style>